package site.yaoer.dongbao.ums.common.base.result;

import lombok.Builder;
import lombok.Data;
import site.yaoer.dongbao.ums.common.base.enums.StateCodeEnum;

import java.io.Serializable;

@Data
@Builder
public class ResultWrapper<T> implements Serializable {

    private int code;

    private String msg;

    private T data;

    public static ResultWrapperBuilder getSuccessBuilder() {
        return ResultWrapper.builder().code(StateCodeEnum.SUCCESS.getCode()).msg(StateCodeEnum.SUCCESS.getMsg());
    }

    public static ResultWrapperBuilder getFailBuilder() {
        return ResultWrapper.builder().code(StateCodeEnum.FAIL.getCode()).msg(StateCodeEnum.FAIL.getMsg());
    }
}
